<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>

<head>
    <script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/js/jqGrid/grid.locale-en.js"></script>
    <script type="text/javascript" src="/js/jqGrid/jquery.jqGrid.min.js"></script>
    <link type="text/css" rel="stylesheet" href="/css/style.css">
    <link type="text/css" rel="stylesheet" href="/css/redmond/jquery-ui-1.8.21.custom.css">
    <link type="text/css" rel="stylesheet" href="/css/jqGrid/ui.jqgrid.css">
    <script>
        $(function(){
            // 配置jqGrid组件
            $("#gridTable").jqGrid({
                url: "filepage",
                datatype: "json",
                mtype: "GET",
                height: 350,
                autowidth: true,
                colModel: [
                    {name:"id",index:"id",label:"ID",width:20,sortable:false},
                    {name:"fileName",index:"fileName",label:"File Name",width:60,sortable:false},
                    {name:"filePath",index:"filePath",label:"File Path",width:180,sortable:false},
                    {name:"weekly",index:"weekly",label:"weekly",width:60,sortable:false},
                    {name:"uploadDate",index:"uploadDate",label:"UpdateDate",width:60,sortable:false}
                ],
                viewrecords: true,
                rowNum: 15,
                rowList: [15,50,100],
                prmNames: {search: "search"},   //(1)
                jsonReader: {
                    root:"rows",       // (2)
                    records: "records",      // (3)
                    repeatitems : false     // (4)
                },
                pager: "#gridPager",
                caption: "File List",
                multiselect: true,
                editurl:"del",
                hidegrid: false
            });
            $("#gridTable").jqGrid('navGrid','#gridPager',{edit:false,add:false,del:true,search:false});
        });


    </script>


<title>Files Manage</title>
</head>
<body>
    <jsp:include page="navigation.jsp"/>
    <h2>
        File List
    </h2>
<%--
    <c:choose>
        <c:when test="${empty filelist}">
          <p style="text-align:center;">No Data！</p>
        </c:when>
        <c:otherwise>
                <table>
                    <tr>
                        <td>
                            File Name
                        </td>
                        <td>
                            File Path
                        </td>
                        <td>
                            Uploaded Date
                        </td>
                        <td>

                        </td>
                    </tr>
                    <c:forEach var="fileinfo" items="${filelist}" varStatus="status">
                        <tr>
                        <td>${fileinfo.fileName }</td>
                        <td>${fileinfo.filePath}</td>
                        <td>${fileinfo.uploadDate }</td>
                        <td>
                            <!--
                            <a href="javascript:void(0)" onclick="javascript:self.location='<%=request.getContextPath() %>scanInfo/${fileinfo.id }'">DETAIL</a>
                            -->
                            <a href="javascript:void(0)" onclick="javascript:self.location='<%=request.getContextPath() %>delFile/${fileinfo.id }'">DELETE</a>
                        </td>
                        </tr>
                    </c:forEach>
                </table>
        </c:otherwise>
    </c:choose>
--%>
    <div>
        <table id="gridTable"></table>
        <div id="gridPager"></div>
    </div>
</body>
</html>